<?php
if (isset($this->data)):
?>
<h1>Twój koszyk</h1>
<form action="<?=$this->formAddress;?>" method="post">
<table>
    <thead>
        <th>Gra</th>
        <th>Cena</th>
        <th>Ilość</th>
        <th>Łącznie</th>
    </thead>
<?php
foreach ($this->data as $basketItem):
?>
    <tr>
            <td><a href="product.php?action=Browse&id=<?=$basketItem->product->id;?>"><?=$basketItem->product->title;?></a></td>
            <td><?=$basketItem->product->price;?> zł</td>
            <td><input type="number" name="<?=$basketItem->product->id;?>" style="width: 100%;" value="<?=$basketItem->quantity;?>" length="3" min="0" /></td>
            <td><?=$basketItem->quantity * $basketItem->product->price;?> zł</td>
    </tr>
<?php
endforeach;
?>
    <tr>
        <td colspan="3">Razem do zapłaty:</td>
        <td><?=$this->basket->getBasketTotalCost();?> zł</td>
    </tr>
</table>
    <input type="submit" name="action" value="Edytuj koszyk" />
    <input type="submit" name="action" value="Wyczyść koszyk" />
</form>
<?php
endif;
?>